<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title> - 百度ECHarts</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="{{ asset('/static/css/bootstrap.min.css?v=3.3.6') }}" rel="stylesheet">
    <link href="{{ asset('/static/css/font-awesome.css?v=4.4.0') }}" rel="stylesheet">

    <link href="{{ asset('/static/css/animate.css') }}" rel="stylesheet">
    <link href="{{ asset('/static/css/style.css?v=4.1.0') }}" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="row  border-bottom white-bg dashboard-header">
    <div class="col-sm-12">
        <p>顾客入住统计</p>
    </div>

</div>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>折线图</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="graph_flot.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="#">选项1
                                </a>
                            </li>
                            <li><a href="#">选项2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="echarts" id="echarts-line-chart"></div>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>柱状图</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="graph_flot.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="#">选项1</a>
                            </li>
                            <li><a href="#">选项2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">

                    <div class="echarts" id="echarts-bar-chart"></div>
                </div>
            </div>
        </div>
    </div>


</div>
<!-- 全局js -->
<script src="{{ asset('/static/js/jquery.min.js?v=2.1.4') }}"></script>
<script src="{{ asset('/static/js/bootstrap.min.js?v=3.3.6') }}"></script>



<!-- ECharts -->
<script src="{{ asset('/static/js/plugins/echarts/echarts-all.js') }}"></script>

<!-- 自定义js -->
<script src="{{ asset('/static/js/content.js?v=1.0.0') }}"></script>


<!-- ECharts demo data
<script src="{{ asset('/static/js/demo/echarts-demo.js') }}"></script>
-->
<script>
    $(function () {

        $.post('/customer/getDay',function(data) //第二个参数要传token的值 再传参数要用逗号隔开
        {
         //console.log(data);
            //var lineChart = echarts.init(document.getElementById("echarts-line-chart"));
            lineoption.xAxis[0].data=data[0];
            var datData=data[1];
            for(var i=0;i<datData.length;i++){
                datData[i] = parseInt(datData[i]);
            }
            lineoption.series[0].data=datData;
            lineChart.setOption(lineoption);
            $(window).resize(lineChart.resize);
        });

        //var data=[11, 11, 15, 13, 12, 13, 10];
        var lineChart = echarts.init(document.getElementById("echarts-line-chart"));
        var lineoption = {
            title: {
                text: '过去7天住房统计'
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data: ['最高入住数']
            },
            grid: {
                x: 40,
                x2: 40,
                y2: 24
            },
            calculable: true,
            xAxis: [
                {
                    type: 'category',
                    boundaryGap: false,
                    data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
                }
            ],
            yAxis: [
                {
                    type: 'value',
                    axisLabel: {
                        formatter: '{value}'
                    }
                }
            ],
            series: [
                {
                    name: '最高入住数',
                    type: 'line',
                    data: [],
                    markPoint: {
                        data: [
                            {type: 'max', name: '最大值'},
                            {type: 'min', name: '最小值'}
                        ]
                    },
                    markLine: {
                        data: [
                            {type: 'average', name: '平均值'}
                        ]
                    }
                }
            ]
        };
        //lineChart.setOption(lineoption);

        $.post('/customer/getMonth',function(data) //第二个参数要传token的值 再传参数要用逗号隔开
        {
            //console.log(data);
            //var lineChart = echarts.init(document.getElementById("echarts-line-chart"));
            baroption.xAxis[0].data=data[0];
            var datData=data[1];
            for(var i=0;i<datData.length;i++){
                datData[i] = parseInt(datData[i]);
            }
            baroption.series[0].data=datData;
            barChart.setOption(baroption);
            $(window).resize(barChart.resize);
        });



        var barChart = echarts.init(document.getElementById("echarts-bar-chart"));
        var baroption = {
            title: {
                text: '一年入住统计'
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data: ['入住数']
            },
            grid: {
                x: 30,
                x2: 40,
                y2: 24
            },
            calculable: true,
            xAxis: [
                {
                    type: 'category',
                    data: []
                }
            ],
            yAxis: [
                {
                    type: 'value'
                }
            ],
            series: [
                {
                    name: '入住数',
                    type: 'bar',
                    data: [],
                    markPoint: {
                        data: [
                            {type: 'max', name: '最大值'},
                            {type: 'min', name: '最小值'}
                        ]
                    },
                    markLine: {
                        data: [
                            {type: 'average', name: '平均值'}
                        ]
                    }
                }
            ]
        };

    });


</script>



</body>

</html>
